package com.sh.data.engine.common.enumDefinition;

import java.util.Objects;

/**
 * @author yunxuan.wrx
 * @describe: 类描述 @Date 2021/3/9 18:21
 */
public enum DataApiTaskTypeEnum {
    GUIDE(0, "(数据库)向导模式", "向导模式"),
    SCRIPT(1, "(数据库)脚本模式", "脚本模式"),
    REGIEST(2, "HTTP/HTTPS", "注册模式"),
    INDEXLIB(3, "指标", "指标");

    DataApiTaskTypeEnum(Integer typeCode, String typeName, String typeDesc) {
        this.typeCode = typeCode;
        this.typeName = typeName;
        this.typeDesc = typeDesc;
    }

    private Integer typeCode;

    private String typeName;

    private String typeDesc;

    public Integer getTypeCode() {
        return typeCode;
    }

    public String getTypeName() {
        return typeName;
    }

    public static DataApiTaskTypeEnum getTaskTypeByCode(Integer code) {
        for (DataApiTaskTypeEnum value : DataApiTaskTypeEnum.values()) {
            if (Objects.equals(value.getTypeCode(), code)) {
                return value;
            }
        }
        return null;
    }
}
